using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class VisionGiver:MonoBehaviour {
	Projectile projectile;
	private void Start() {
		projectile=GetComponent<Projectile>();
	}

	private void OnEnable() {
		FowController.GetFowObservers+=FowController_GetFowObservers;
	}
	private void OnDisable() {
		FowController.GetFowObservers-=FowController_GetFowObservers;
	}

	private void FowController_GetFowObservers(object sender) {
		if(!projectile.shooterMob) return;
		if(!(projectile.shooterMob is Player)) return;
		(sender as FowController).AddObserver(Vector2Int.RoundToInt(transform.position),visionRange);
	}

	public int visionRange;

}
